Fixed crash-on-loading bug (width and height are not set until
authorMark Crichton <crichton@src.gnome.org>
Mon, 12 Jul 1999 04:55:16 +0000 (04:55 +0000)
committerMark Crichton <crichton@src.gnome.org>
Mon, 12 Jul 1999 04:55:16 +0000 (04:55 +0000)
Fixed crash-on-loading bug (width and height are not set until decompression
starts)

Mark

gdk-pixbuf/io-jpeg.c

index 3ba9c36a0e106a13e5415c3d44b7af2531d87df2..b75155dbd85d8170823bd36605e6b9a3cd523d04 100644 (file)
@@ -67,10 +67,13 @@ GdkPixBuf *image_load(FILE *f)
        jpeg_create_decompress(&cinfo);
        jpeg_stdio_src(&cinfo, f);
        jpeg_read_header(&cinfo, TRUE);
+       jpeg_start_decompress(&cinfo);
        cinfo.do_fancy_upsampling = FALSE;
        cinfo.do_block_smoothing = FALSE;
+
        w = cinfo.output_width;
        h = cinfo.output_height;
+       g_print("w: %d h: %d\n", w, h);
 
        pixels = art_alloc(h * w * 3);
        if (pixels == NULL) {
@@ -80,7 +83,6 @@ GdkPixBuf *image_load(FILE *f)
        dptr = pixels;
 
        /* decompress all the lines, a few at a time */
-       jpeg_start_decompress(&cinfo);
 
        while (cinfo.output_scanline < cinfo.output_height) {
                lptr = lines;